<?php

namespace App\Models\Traits;

use App\Services\TakeUserVipWelfare\TakeUserVipWelfare;

trait HasUserVipPurchase
{
	public function userVipWelfare()
	{
		return app(TakeUserVipWelfare::class, [
			'user' => $this
		])->take();
	}
	
	public function userCanTakeVipPurchase()
	{
		return $this->vipPurchases()
			->whereNotNull('paid_at')
			->where('is_taken', false);
	}

	public function userCanTakeVipPurchaseCount()
	{
		return $this->userCanTakeVipPurchase()->count();
	}
}
